﻿<common:LayoutAwarePage
    x:Class="Tuan.ItemDetailsPage"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Tuan"
    xmlns:common="using:Tuan.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.Background>
            <ImageBrush ImageSource="{Binding Mode=OneWay, Source={StaticResource Background}}"/>
        </Grid.Background>

        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Button x:Name="backButton" Click="GoBack"  IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>

            <StackPanel Grid.Column="1" Orientation="Horizontal">
                <TextBlock x:Name="PageTitle" Text="{StaticResource AppName}" Grid.Column="1" Style="{StaticResource PageHeaderTextStyle}" FontFamily="KaiTi"></TextBlock>
                <TextBlock x:Name="CityName" Text="{Binding CityName}" Grid.Column="1" Style="{StaticResource PageHeaderTextStyle}" FontFamily="KaiTi"></TextBlock>
            </StackPanel>
        </Grid>

        <!--Define two column-->
        <Grid Grid.Row="1" Margin="60,0,60,50" x:Name="dealInfoPanel">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <!--The left column-->
            <Grid Grid.Column="0" Margin="0,20,0,20" Background="DarkGreen">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <Image Source="Assets/discount.png" Width="100" Height="100" HorizontalAlignment="Left"></Image>
                <Image Source="Assets/new.png" Width="100" Height="100" HorizontalAlignment="Left"></Image>
                <StackPanel Grid.Row="0" Orientation="Horizontal">
                    <TextBlock Text="{Binding Discount}" FontSize="50" Margin="25,25,0,0"/>
                    <Image Source="Assets/discount02.png" Width="100" Height="100"/>
                </StackPanel>

                <StackPanel Grid.Row="1" Orientation="Vertical" Margin="10,10,0,0">
                    <TextBlock x:Name="tbShortTitle"  Text="{Binding ShortTitle}" Style="{StaticResource BodyTextStyle}" Margin="10,0,0,0"></TextBlock>
                    <StackPanel Orientation="Horizontal" Margin="10,0,0,0">
                        <TextBlock Text="现价：" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="{Binding Price}" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="元" Style="{StaticResource BodyTextStyle}"></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="10,0,0,0">
                        <TextBlock Text="原价：" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="{Binding Value}" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="元" Style="{StaticResource BodyTextStyle}"></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="10,0,0,0">
                        <TextBlock Text="已有" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="{Binding Bought}" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="人购买" Style="{StaticResource BodyTextStyle}"></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <HyperlinkButton x:Name="hbDealLink" Content="立即抢购" NavigateUri="{Binding UriLink}" FontFamily="KaiTi" Margin="5,0,0,0" Background="#FFF3370D" Foreground="#FFF8F6FD"></HyperlinkButton>
                        <Button x:Name="showShareButton" Content="分享" Margin="5,0,0,0" Click="ShowShareButton_Click"  FontFamily="KaiTi" Background="Blue" BorderThickness="0" />
                    </StackPanel>
                    <TextBlock Style="{StaticResource BodyTextStyle}" Margin="10,0,0,0" Height="110"></TextBlock>
                    <TextBlock x:Name="tbTitle" Text="{Binding Title}" VerticalAlignment="Bottom" Height="100" ScrollViewer.VerticalScrollBarVisibility="Auto" Width="250" Style="{StaticResource BodyTextStyle}"  HorizontalAlignment="Left" Margin="10,0,0,0"/>
                    <StackPanel Orientation="Horizontal" Margin="10,10,0,0">
                        <TextBlock Text="开始时间：" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="{Binding StartTime}" Style="{StaticResource BodyTextStyle}"></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal"  Margin="10,0,0,0">
                        <TextBlock Text="结束时间：" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="{Binding EndTime}" Style="{StaticResource BodyTextStyle}"></TextBlock>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal"  Margin="10,0,0,0">
                        <TextBlock Text="还有" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="{Binding ExpireTime}" Style="{StaticResource BodyTextStyle}"></TextBlock>
                        <TextBlock Text="天过期" Style="{StaticResource BodyTextStyle}"></TextBlock>
                    </StackPanel>
                    <TextBlock Text="团购数量有限，下单要快哟" Style="{StaticResource BodyTextStyle}" Margin="10,10,0,10" Height="40"></TextBlock>
                </StackPanel>
            </Grid>

            <!--The right column-->
            <Grid Grid.Column="1" Margin="60,20,0 20">
                <Grid.RowDefinitions >
                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                </Grid.RowDefinitions>

                <StackPanel Orientation="Horizontal" Grid.Row="0">
                    <Button Click="DescriptionButton_Click" Grid.Row="0" Grid.Column="0" Margin="10,0,0,0" Content="概述" Style="{StaticResource TextButtonStyle}"/>
                    <Button Click="DetailsButton_Click" Grid.Row="0" Grid.Column="0" Margin="10,0,0,0" Content="详细信息" Style="{StaticResource TextButtonStyle}"/>
                </StackPanel>

                <Canvas Grid.Row="1" Background="DarkGreen" Width="700" Height="600" Canvas.ZIndex="3" HorizontalAlignment="Left" Name="Discription1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="*"></RowDefinition>
                        </Grid.RowDefinitions>

                        <Grid Grid.Row="0" HorizontalAlignment="Left">
                            <Image Source="{Binding Image}" Margin="20,30,0,0" Width="500" Height="300" Stretch="Fill"/>
                        </Grid>
                        <StackPanel Grid.Row="3">
                            <TextBlock Text="{Binding ShortTitle}" MaxHeight="30" Width="500" Margin="20,20,20,10" FontWeight="Bold" FontFamily="KaiTi" FontSize="25" TextWrapping="Wrap"/>
                            <TextBlock Text="{Binding Title}" Width="500" Height="120" Margin="20,0,20,0" Style="{StaticResource BodyTextStyle}" TextWrapping="Wrap"/>
                        </StackPanel>
                    </Grid>
                </Canvas>

                <Canvas Grid.Row="1" Background="DarkGreen" Height="600" Width="700" HorizontalAlignment="Left" Canvas.ZIndex="2" Name="Discription2">
                    <StackPanel Orientation="Vertical" Margin="15,0,18,20">
                        <TextBlock Grid.Row="3" Width="600" Text="特别提示" Margin="0,0,18,20" Style="{StaticResource BodyTextStyle}"/>
                        <TextBlock Width="500" HorizontalAlignment="Left" Text="{Binding Details}" Margin="0,0,18,20" Style="{StaticResource BodyTextStyle}" ScrollViewer.HorizontalScrollBarVisibility="Visible">
                        </TextBlock>
                    </StackPanel>
                </Canvas>

            </Grid>
        </Grid>
    </Grid>
</common:LayoutAwarePage>